Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle > Handle deleteForward before a non-selectable and deleteBackward after a non-selectable #2909

Merged
merged 2 commits into from
Feb 1, 2024

Conversation

Liboul
Copy link
Collaborator

@Liboul Liboul commented Feb 1, 2024

After extensively testing the toggle plugin, I've found that the behaviour of deleteBackward was not deterministic. This PR ensures that it is.

The right behaviour of deleteBackward, in case the cursor is right after a closed toggle, is to merge the current node with the toggle, bypassing the hidden content.

Similarly, the right behaviour of deleteForward, in case the cursor is right before a closed toggle, is to merge the current node with the toggle, bypassing the hidden content.

This behaviour would be rendered useless in case a isHidden prop becomes available in Slate, but for now this is the best I could come up with.

Screen.Recording.2024-02-01.at.04.31.35.mov

Copy link

changeset-bot bot commented Feb 1, 2024

🦋 Changeset detected

Latest commit: 3cca1ac

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@udecode/plate-toggle Patch
@udecode/plate Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Feb 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
plate ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 1, 2024 10:27am

zbeyens
zbeyens previously approved these changes Feb 1, 2024
@zbeyens zbeyens merged commit cc0011c into main Feb 1, 2024
4 of 5 checks passed
@zbeyens zbeyens deleted the liboul/toggle/fix/delete-backward-forward branch February 1, 2024 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants